<template>
	<view class="content">
		<view class="avatorWrapper">
			<view class="avator"><image class="img" :src="userInfo.nickName?userInfo.avatarUrl:'../../static/images/11.jpg'" mode="widthFix"></image></view>
		</view>
		<h3 class='nickName'>{{userInfo.nickName?userInfo.nickName:'用户名'}}</h3>
		<view class="form">
			<view class="loginBtn"  @click="Login" v-if="!userInfo.nickName"><text class="btnValue">获取用户信息</text></view>
			<view class="loginBtn" v-else @click="toPersonal"><text class="btnValue" >登录</text></view>
			<view class="forgotBtn"><text>找回密码</text></view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			title: 'Hello',
			userInfo:{}
		};
	},
	onLoad() {},
	methods: {
		Login() {
			wx.getUserProfile({
				desc: '用于完善会员资料', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
				success: res => {
					uni.setStorageSync('userInfo', res.userInfo);
					this.userInfo=res.userInfo
				}
			});
		},
		toPersonal(){
			uni.reLaunch({
				url:'/pages/personal/personal'
			})
		}
	}
};
</script>

<style>
.content {
	background: #00ce47;
	width: 100vw;
	height: 100vh;
}
.avatorWrapper {
	height: 30vh;
	width: 100vw;
	display: flex;
	justify-content: center;
	align-items: flex-end;
}
.avator {
	width: 200upx;
	height: 200upx;
	overflow: hidden;
}
.avator .img {
	width: 100%;
}
.form {
	padding: 0 100upx;
	margin-top: 80px;
}
.inputWrapper {
	width: 100%;
	height: 80upx;
	background: white;
	border-radius: 20px;
	box-sizing: border-box;
	padding: 0 20px;
	margin-top: 25px;
}
.inputWrapper .input {
	width: 100%;
	height: 100%;
	text-align: center;
	font-size: 15px;
}
.loginBtn {
	width: 100%;
	height: 80upx;
	background: #0ea391;
	border-radius: 50upx;
	margin-top: 50px;
	display: flex;
	justify-content: center;
	align-items: center;
}
.loginBtn .btnValue {
	color: white;
}
.forgotBtn {
	text-align: center;
	color: #eaf6f9;
	font-size: 15px;
	margin-top: 20px;
}
.nickName{
	width: 100%;
	text-align: center;
	font-size: 32rpx;
	color: #fff;
	line-height: 150rpx;
}
</style>
